﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ZX.WebApp.EHR
{
    public partial class hrAddResume : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void UploadButton_Click(object sender, EventArgs e)
        {
            if (this.flag.Value == "1") return;
            ///'遍历File表单元素
            HttpFileCollection files = HttpContext.Current.Request.Files;

            /// '状态信息
            System.Text.StringBuilder strMsg = new System.Text.StringBuilder();
            strMsg.Append("上传的文件分别是：<hr color='red'/>");
            try
            {
                for (int iFile = 0; iFile < files.Count; iFile++)
                {
                    ///'检查文件扩展名字
                    HttpPostedFile postedFile = files[iFile];
                    string fileName;
                    fileName = System.IO.Path.GetFileName(postedFile.FileName);
                    if (fileName != "")
                    {
                        postedFile.SaveAs(System.Web.HttpContext.Current.Request.PhysicalApplicationPath +"EHR/upload/"+ fileName);
                    }
                }
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('文件上传成功！');</script>", false);
            }
            catch (System.Exception Ex)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('文件上传失败！" + Ex.Message + "');</script>", false);
            }
        }
    }
}